﻿<sdk:ChildWindow 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:my="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" 
	xmlns:mycommon="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl.Common"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
	x:Class="BuildARoute.RouteWindow"
	Width="900" Height="600" Background="White" BorderBrush="{x:Null}" mc:Ignorable="d" 
	DataContext="{Binding RelativeSource={RelativeSource Self}}">
    

    
    <toolkit:BusyIndicator IsBusy="{Binding IsBusyIndicatorOn}">
		<Grid Name="LayoutRoot">
			<Grid.RowDefinitions>
				<RowDefinition x:Name="TitleRow" Height="Auto"/>
                <RowDefinition x:Name="MainRow"  Height="*"/>
			</Grid.RowDefinitions>

            <TextBlock x:Name="tourTitleTextBlock"
                       Grid.Row="0" HorizontalAlignment="Center"
                       TextWrapping="Wrap" Text="{Binding CurrentTour.Title, TargetNullValue=NullTourTitle}"
					   FontSize="48" FontFamily="Edwardian Script ITC"
					   Foreground="{StaticResource ApplicationNameBrush}"/>
            
            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition x:Name="MapCollumn" Width="*"/>
                    <ColumnDefinition x:Name="AccordionColumn" Width="*"/>
                </Grid.ColumnDefinitions>
                <Border Name="MapBorder" Grid.Column="0" >
                    <my:Map CredentialsProvider="{Binding MapInfo.CP}"
						Name="mapControl" 
						UseInertia="True">
                        <my:MapLayer Name="routeLayer"/>
                        <my:MapLayer Name="pushPinsLayer">
                            <my:MapItemsControl ItemTemplate="{StaticResource pushPinTemplate}"
												DataContext="{Binding CurrentTour.POIs}"
												ItemsSource="{Binding}"/>
                        </my:MapLayer>
                    </my:Map>
                </Border>
                <Border Name="InfoBorder" Grid.Column="1"
                    BorderThickness="5" BorderBrush="CornflowerBlue">
                    <toolkit:Accordion>

                        <toolkit:AccordionItem Header="General Info">
                            <StackPanel Name="generalInfoStackPanel" Orientation="Vertical">
                                <Image Height="200" HorizontalAlignment="Left"
								   Name="image1" VerticalAlignment="Top"
								   Width="200" Source="{Binding CurrentTour.ImageURI}"/>
                                <TextBlock Name="shortDescriptionTextBlock"
									   Text="{Binding CurrentTour.ShortDescription}"/>

                            </StackPanel>
                        </toolkit:AccordionItem>

                        <toolkit:AccordionItem Header="Community Reviews">
                            <StackPanel>
                                <StackPanel HorizontalAlignment="Left" Height="22" Orientation="Horizontal"
										Width="179">
                                    <toolkit:Rating Name="tourRating" IsReadOnly="True"
												Value="{Binding CurrentTour.Rating}" ItemCount="5"/>
                                    <TextBlock TextWrapping="Wrap" Text="(0) Reviews"
										   VerticalAlignment="Bottom" />
                                    <ListBox x:Name="reviewsListBox"/>
                                </StackPanel>

                            </StackPanel>
                        </toolkit:AccordionItem>

                        <toolkit:AccordionItem Header="What's to see in this route?">
                            <Grid ShowGridLines="True">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <ListBox Name="poiListBox" Grid.Column="0"
                                         ItemTemplate="{StaticResource poiDataTemplate}"
                                         ItemsSource="{Binding CurrentTour.POIs}"/>
                                <Button Grid.Column="1" VerticalAlignment="Top" Content=">" Width="37" Height="39"
								    ToolTipService.ToolTip="View details"
								    Template="{StaticResource redCircleButtonControlTemplate}"/>
                            </Grid>
                        </toolkit:AccordionItem>

                    </toolkit:Accordion>
                </Border>
            </Grid>

		</Grid>
	</toolkit:BusyIndicator>
</sdk:ChildWindow>